<?php

namespace app\middleware;

use Webman\Http\Response;
use Webman\Http\Request;
use Webman\MiddlewareInterface;

class FilterParameters implements MiddlewareInterface
{
    public function process(Request $request, callable $next): Response
    {
        $request->allParam = $request->all();

        $request->platform = $request->header('platform') ? $request->header('platform'):'WEB';
        $request->version = $request->header('version') ?? '';
        $request->deviceNumber = $request->header('device') ?? '';
        $request->uuid = $request->header('device') ?? '';
        $request->startExceTime = microtime(true);
        $request->sqllogDebug = '';

        return $next($request);
    }
}
